#!/usr/bin/python3
# -*- coding: utf-8 -*-

"""
用户ORM模型

使用SQLAlchemy ORM定义用户领域模型
"""

from sqlalchemy import Column, String, Integer, Text
from app.utils.sqlalchemy_utils import BaseModel


class User(BaseModel):
    """用户ORM模型"""
    
    __tablename__ = 'users'  # 表名
    
    user_id = Column(String(50), unique=True, nullable=False, doc="用户业务ID")
    username = Column(String(50), unique=True, nullable=False, doc="用户名")
    password = Column(String(100), nullable=False, doc="密码")
    email = Column(String(100), unique=True, doc="邮箱")
    name = Column(String(50), doc="姓名")
    age = Column(Integer, doc="年龄")
    gender = Column(String(10), doc="性别")
    address = Column(Text, doc="地址")
    phone = Column(String(20), doc="电话")
    birthday = Column(String(20), doc="生日")
    company = Column(String(100), doc="公司")
    job = Column(String(50), doc="职位")
    website = Column(String(100), doc="网站")
    token = Column(String(100), doc="令牌")
    
    def __init__(self, **kwargs):
        """初始化用户对象"""
        super(User, self).__init__(**kwargs)
    
    def __repr__(self):
        """字符串表示"""
        return f"<User {self.username}>" 